<?php
namespace app\controllers;

use yii\web\Response;
use yii\web\Controller;
use app\filters\ParamAuth;
use app\filters\ResponseFilter;

class AjaxController extends Controller
{
	public function behaviors() {
		return [
			'response' => [
				'class' => ResponseFilter::className()
			]
		];
	}
	
    public function init() {
        \Yii::$app->getResponse()->format = Response::FORMAT_JSON;
    }
    
//     public function runLogic(\Closure $closure) {
//     	$closure->bindTo($this);
//     	try {
//     		$closure();
//     	} catch (\app\exceptions\FormParamNotValidateException $e) {
//     		return ['error' => $e->model->getErrors(), 'status' => $e->getCode()];
//     	} catch (\app\exceptions\BusinessException $e) {
//     		return ['error' => $e->getMessage(), 'status' => $e->getCode()];
//     	}
//     }
}

?>